const express = require('express');
var cors = require('cors');

const app = express();
app.use(cors());

//设置网站根目录
app.use(express.static('./public'));

// http://192.168.20.111/api
app.get('/api', (req, res) => {
    return res.json({
        "id": 4666,
        "uuid": "ae97af26-231f-4b62-ae6a-92db4dff4c20",
        "hitokoto": "明月装饰了你的窗子，你装饰了别人的梦。",
        "type": "g",
        "from": "断章",
        "from_who": null,
        "creator": "smallxu",
        "creator_uid": 2639,
        "reviewer": 1044,
        "commit_from": "web",
        "created_at": "1569328047",
        "length": 19
    })
})

app.listen(80, () => {
    console.log('服务已经启动....');
});